package org.blindmandesign;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
 */

import org.blindmandesign.Parser;

/**
 *
 * @author Nathan Bubna
 * @since javaQuery 1.0
 * @version $Id$
 */
public class Config {

    public static final String DEFAULT_NEWLINE = "\n";
    public static final String DEFAULT_TAB = "  ";
    public static final String DEFAULT_DELIMITER = " ";

    private String newline = DEFAULT_NEWLINE;
    private String tab = DEFAULT_TAB;
    private String delim = DEFAULT_DELIMITER;
    private Parser parser;
    private boolean locked = false;

    protected void lock(boolean locked) {
        this.locked = locked;
    }

    public boolean isLocked() {
        return locked;
    }

    public Config setNewLine(String newline) {
        if (!locked) {
            this.newline = newline;
            return this;
        }
        return null;
    }

    public String getNewLine() {
        return this.newline;
    }

    public Config setTab(String tab) {
        if (!locked) {
            this.tab = tab;
            return this;
        }
        return null;
    }

    public String getTab() {
        return this.tab;
    }

    public Config setDelimiter(String delim) {
        if (!locked) {
            this.delim = delim;
            return this;
        }
        return null;
    }

    public String getDelimiter() {
        return this.delim;
    }

    public Config setParser(Parser parser) {
        if (!locked) {
            this.parser = parser;
            return this;
        }
        return null;
    }

    public Parser getParser() {
        return this.parser;
    }

}
